import 'package:enterprise_v6_app/app/components/custom_app_bar.dart';
import 'package:enterprise_v6_app/app/core/values/colors.dart';
import 'package:enterprise_v6_app/app/core/values/gaps.dart';
import 'package:enterprise_v6_app/app/modules/application/double_prevention_page/risk_control_page/risk_security_identification_page/risk_step_details/risk_step_details_controller.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class RiskStepDetailsPage extends StatelessWidget {
  RiskStepDetailsPage({super.key});

  final controller = Get.put(RiskStepDetailsController());
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.bg_color_grey,
      appBar: CustomAppBar(
        titleText: '详情',
      ),
      body: GetBuilder(
        init: controller,
        builder: (_) {
          return SingleChildScrollView(
            child: Column(
              children: [
                _titleBg(),
                Container(
                  height: 40.w,
                  width: double.infinity,
                  color: const Color(0xFFF4F7FF),
                  alignment: Alignment.centerLeft,
                  padding: EdgeInsets.only(left: 40.w),
                  child: Text(
                    '管控措施描述：${controller.data?.riskMeasureDesc ?? ''}',
                    style: TextStyle(
                      fontSize: 16.sp,
                    ),
                  ),
                ),
                Container(
                  height: 1.w,
                  color: const Color(0xFFDEE5FD),
                ),
                Container(
                  color: Colors.white,
                  padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
                  child: Column(
                    children: [
                      Row(
                        children: [
                          AppGaps.hGap40,
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              _leftTitle('管控措施描述：', Colors.black),
                              AppGaps.vGap12,
                              _leftTitle('管控手段：', Colors.black),
                              AppGaps.vGap12,
                              _leftTitle('管控措施层级：', Colors.black),
                              AppGaps.vGap12,
                              _leftTitle('隐患排查条目：', Colors.black),
                              AppGaps.vGap12,
                              _leftTitle('管控措施分类1：', Colors.black),
                              AppGaps.vGap12,
                              _leftTitle('管控措施分类2：', Colors.black),
                              AppGaps.vGap12,
                              _leftTitle('管控措施分类3：', Colors.black),
                              AppGaps.vGap12,
                              _leftTitle('后果降低值：', Colors.black),
                              AppGaps.vGap12,
                              _leftTitle('可能性降低值：', Colors.black),
                            ],
                          ),
                          AppGaps.hGap40,
                          Expanded(
                              child: Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  _leftTitle(
                                    controller.data?.riskMeasureDesc ?? '',
                                    const Color(0xFF7C7D93),
                                  ),
                                  AppGaps.vGap12,
                                  _leftTitle(
                                    controller.data?.dataSrcLabel ?? '',
                                    const Color(0xFF7C7D93),
                                  ),
                                  AppGaps.vGap12,
                                  _leftTitle(
                                    controller.data?.riskMeasureLevelLabel ?? '',
                                    const Color(0xFF7C7D93),
                                  ),
                                  AppGaps.vGap12,
                                  _leftTitle(
                                    controller.data?.troubleshootContent ?? '',
                                    const Color(0xFF7C7D93),
                                  ),
                                  AppGaps.vGap12,
                                  _leftTitle(
                                    controller.data?.classify1Label ?? '',
                                    const Color(0xFF7C7D93),
                                  ),
                                  AppGaps.vGap12,
                                  _leftTitle(
                                    controller.data?.classify2Label ?? '',
                                    const Color(0xFF7C7D93),
                                  ),
                                  AppGaps.vGap12,
                                  _leftTitle(
                                    controller.data?.classify3 ?? '',
                                    const Color(0xFF7C7D93),
                                  ),
                                  AppGaps.vGap12,
                                  _leftTitle(
                                    '${controller.data?.consequenceReduction ?? ''}',
                                    const Color(0xFF7C7D93),
                                  ),
                                  AppGaps.vGap12,
                                  _leftTitle(
                                    '${controller.data?.probabilityReduction ?? ''}',
                                    const Color(0xFF7C7D93),
                                  ),
                                ],
                              ))
                        ],
                      )
                    ],
                  ),
                ),
              ],
            ),
          );
        },
      ),
    );
  }

  Widget _leftTitle(String title, Color color) {
    return Text(
      overflow: TextOverflow.ellipsis,
      title,
      style: TextStyle(
        color: color,
        fontSize: 12.sp,
      ),
    );
  }


  /// 标题背景分隔栏
  Widget _titleBg() {
    return Column(
      children: [
        AppGaps.vGap12,
        Container(
          height: 2.w,
          color: const Color(0xFF587DF5),
        ),
      ],
    );
  }
}
